<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 自定义两组样式，控制transition内部的元素实现动画 -->
    <style> 
        /* 时间点，元素的起始状态 */
        .v-enter, 
       /* 时间点，离开的终止状态 */
        .v-leave-to {
            opacity: 0;
            transform: translateX(100px);
        }

        /* 入场动画的时间段 */
        .v-enter-active,
        /* 离场动画的时间段 */
        .v-leave-active {
            transition: all 0.8s ease;
        }


        /* 自定义标签 */
        .my-enter, 
        .my-leave-to {
            opacity: 0;
            transform: translateY(100px);
        }

        .my-enter-active,
        .my-leave-active {
            transition: all 0.8s ease;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="button" value="toggle" @click="flag =! flag" />
        <!--transition元素，是vue官方提供-->
        <transition>
            <h3 v-if="flag">这是一个h3标签</h3>
        </transition>

        <hr/>

        <input type="button" value="toggle" @click="flag2 =! flag2" />
        <transition name="my">
            <h3 v-if="flag2">这是一个h3标签</h3>
        </transition>
        
    </div>
    <script src="../../js/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                flag: false,
                flag2: false
            },
        });
    </script>
</body>
</html>